#ifndef EYELOCALIZER_H
#define EYELOCALIZER_H

#include "cv.h"
#include "highgui.h"


using namespace cv;

class EyeLocalizer
{
public:
	EyeLocalizer(IplImage* image,Rect rect);
	~EyeLocalizer(void);
	void LocateEyes(Point& le,Point& re);
private:
	unsigned int GetAreaSum(int left, int top, int right,int bottom);
	inline unsigned int GetAreaSum(int x,int y);
	void CalculateSum(); 
	bool Comparable(int dif1,int dif2,int var);
	void SearchArea(int left,int top,int width,int height,int frameW, int frameH,Point& eye);
private:
	IplImage *detectRegion,*grayRegion;
	vector<vector<int>> pixelSumMatrix;
	Rect rect;
	int width,height;
};


#endif
